import rentadomus.IdentificationType
import rentadomus.IdentificationType
import rentadomus.Person
import rentadomus.Place
import rentadomus.Warehouse
import rentadomus.Contract
import rentadomus.Images


class BootStrap {

    def init = { servletContext ->
        def cc=new IdentificationType(name:"ID Card",acronym:"IC", description:"Identity card")
        cc.save()
        new IdentificationType(name:"Foreign Identity Card",acronym:"FID", description:"Foreign Identity Card").save()
        new IdentificationType(name:"Child ID Card",acronym:"CIC", description:"Child Identification Card").save()
        new IdentificationType(name:"Register",acronym:"CR", description:"Civil Register").save()
        new IdentificationType(name:"Passport",acronym:"PA", description:"Passsport").save()
        def filePath = "wep-app/fpc_report.txt"
        Person p=new Person(
            identification:"6",
            name:"Jairo",
            lastName:"Aponte",
            email:"profesor@unal.edu.co",
            address:"Fake St 123",
            username:"nicolas",
            password:"laverde",
            password2:"laverde",
            identificationType:cc
        ).save(flush: true)
        Place place=new Place(
            idPerson:p,
            titlePlace:"Cute WareHouse",
            address:"Evergreen St 742",
            neighborhood:"Springfield",
            strata:2,
            rentPrice:10000,
            area:72,
            description:"Cute place!",
            energy:true,
            water:false,
            gas:false,
            wifi:false,
            phone:false,
            cableTv:false
        ).save(flush: true)
        Warehouse w=new Warehouse(
            idPlace:place,
            warehouseType:"Other",
            hasOffice:true
        ).save(flush: true)
        Locale.setDefault(Locale.ENGLISH)
    }
    
    def destroy = {
        
    }
}
